package com.junsi.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.junsi.bean.Sources;
import com.junsi.mapper.SourcesMapper;
import com.junsi.service.SourcesService;

@Service
@Transactional(rollbackFor = Exception.class)
public class SourcesServiceImpl implements SourcesService{

	@Autowired
	private SourcesMapper sourcesMapper;

	@Override
	public List<Sources> listAll() {
		List<Sources> lsit = sourcesMapper.listAll();
		return lsit;
	}

	@Override
	public Sources findById(Integer id) {
		Sources record = sourcesMapper.findById(id);
		return record;
	}

	@Override
	public boolean insert(Sources o) throws Exception {

		int result = sourcesMapper.insert(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	public boolean update(Sources o) throws Exception {

		int result = sourcesMapper.update(o);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	public boolean delete(Integer id) {

		int result = sourcesMapper.delete(id);
		if (result == 1) {
			return true;
		} else {
			return false;
		}

	}

}
